<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui"%>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys"%>
<%
    String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>${tabTitle}</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
	<div class="Wrapper">
		<div>
			<div id="pageInTab" class="pageInTab">
				<form id="ins_cfg_info_edit_form">
					<div class="fieldset1 tabel_col clearFix">
						<div class="fieldBox col_33">
							<div class="label">机构名称</div>
							<div class="field">
								<span name="fundRasInsNm" id="fundRasInsNm">${fundRasInsNm}</span>
							</div>
						</div>
						<div class="fieldBox col_33">
							<div class="label">客户名称</div>
							<div class="field">
								<span >${cstNm}</span>
							</div>
						</div>
						<div class="fieldBox col_33">
							<div class="label">身份证号码</div>
							<div class="field">
								<span >${certNo}</span>
							</div>
						</div>
						<div class="fieldBox col_33">
							<div class="label">开户银行</div>
							<div class="field">
                                <select name="bkNo" id="bkNo" value="${bkNo}" validate="{required:true}">
	                                <c:if test="${bkNo == null || bkNo == ''}">
	                                	<option value="" selected="selected">--请选择--</option>
	                                </c:if>
	                                <c:if test="${bkNo != null && bkNo != ''}">
	                                	<option value="">--请选择--</option>
	                                </c:if>
                                    <c:forEach items="${bankList}" var="item">
                                    	<c:if test="${item.key == bkNo}">
                                        	<option value="${item.key}" selected="selected">${item.value}</option>
                                    	</c:if>
                                    	<c:if test="${item.key != bkNo}">
                                        	<option value="${item.key}">${item.value}</option>
                                    	</c:if>
                                    </c:forEach>
                                </select>
								<span class="requiredSymbol">*</span>
							</div>
						</div>
						<div class="fieldBox col_33">
							<div class="label">银行账号</div>
							<div class="field">
								<input name="accNo" id="accNo" type="text" class="ui-textbox" value="${accNo}" validate="{number:true, maxlength:22, minlength:15}">
								<span class="requiredSymbol">*</span>
							</div>
						</div>
						<div class="fieldBox col_33">
							<div class="label">预留手机号</div>
							<div class="field">
								<input name="mp" id="mp" type="text" class="ui-textbox" value="${mp}" validate="{number:true, maxlength:11, minlength:11}">
								<span class="requiredSymbol">*</span>
							</div>
						</div>
						<div class="fieldBox col_33">
							<div class="label">学历</div>
							<div class="field">
								<select name="highDgCd" id="highDgCd" value="${highDgCd}" validate="{required:true}">
									<c:if test="${highDgCd == null || highDgCd == ''}">
										<option value=" " selected="selected">--请选择--</option>
									</c:if>
									<c:if test="${highDgCd != null && highDgCd != ''}">
										<option value=" ">--请选择--</option>
									</c:if>
									<c:forEach items="${highDgCdList}" var="item">
										<c:if test="${item.key == highDgCd}">
											<option value="${item.key}" selected="selected">${item.value}</option>
										</c:if>
										<c:if test="${item.key != highDgCd}">
											<option value="${item.key}">${item.value}</option>
										</c:if>
									</c:forEach>
								</select>
								<span class="requiredSymbol">*</span>
							</div>
						</div>
						<div class="fieldBox col_33">
							<div class="label">月收入</div>
							<div class="field">
								<input name="monIncmYuan" id="monIncmYuan" type="text" class="ui-textbox" value="${monIncmYuan}" validate="{number:true, maxlength:11, minlength:4}">
								<span class="requiredSymbol">*</span>
							</div>
						</div>
						<div class="fieldBox col_33">
							<div class="label">浦发开户状态</div>
							<div class="field">
								<input name="thdaccsts" id="thdaccsts" readonly= "true" type="text" class="ui-textbox" value="${thdaccsts}">
								<%--<span class="requiredSymbol">*</span>--%>
							</div>
						</div>
						<div class="fieldBox col_66">
							<div class="label">开户失败</div>
							<div class="field">
								<textarea name="thdaccrem" id="thdaccrem" readonly="true" rows="5" class="l-textarea" style="width:80%" value="" ></textarea>
								<input name="thdaccrems" id="thdaccrems" type="hidden" value="${thdaccrem}">
								<%--<span class="requiredSymbol">*</span>--%>
							</div>
						</div>
						<!-- hide data -->
						<div class="fieldBox col_100" style="display: none;">
							<div class="field">
								<input name="prjId" id="prjId" type="text" class="ui-textbox" value="${prjId}">
								<input name="cstId" id="cstId" type="text" class="ui-textbox" value="${cstId}">
								<input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="${cstNm}">
								<input name="certNo" id="certNo" type="text" class="ui-textbox" value="${certNo}">
								<input name="cstAccInfoId" id="cstAccInfoId" type="text" class="ui-textbox" value="${cstAccInfoId}">
								<input name="fundRasInsId" id=fundRasInsId type="text" class="ui-textbox" value="${fundRasInsId}">
							</div>
						</div>
					</div>
					<!-- REQ-7008 pc保存月收入 pc端不进行保存开户操作 先不改动原接口 增加 -->
					<div id="saveInsCfgDivInfo" class="btnsBox">
						<sys:FlowFrmAth preTaskIds="${preTaskIds}" athCd="addPrjBscInfo" pInstId="${pInstId}">
							<span id="saveInsCfgInfo" class="sq-button sq-button-round" onclick="return saveInfo();">保存</span>
						</sys:FlowFrmAth>
					</div>
					<div id="hintInfo" style="text-align: center">
						<span style="color: red">友情提示：浦发开户操作请移至狮桥在线操作，本页面仅支持修改月收入和学历</span>
					</div>
					<div id="hint" style="text-align: center">
						<span style="color: red">友情提示：浦发开户操作请移至狮桥在线操作</span>
					</div>
				</form>
			</div>
		</div>
	</div>

<script type="text/javascript">

var detailFlag = '${detailFlag}';
// REQ-7008 信审初审节点 客户经理 可修改字段
var fromCAFlag = '${fromCAFlag}';
var fromCMFlag = '${fromCMFlag}';

$(function () {
	initData();
});

function initData() {
    $("#ins_cfg_info_edit_form").ligerForm({
        validate: true
    });
    $("#thdaccrem").val($("#thdaccrems").val());
	disabledInput();
	enableFields();
}

function disabledInput() {
	liger.get("bkNo").setDisabled();
	liger.get("accNo").setDisabled();
	liger.get("mp").setDisabled();
	$("#hint").hide();
	if(detailFlag == "true") {
		liger.get("monIncmYuan").setDisabled();
		liger.get("highDgCd").setDisabled();
        $("#hint").hide();
		$("#saveInsCfgDivInfo").hide();
		$("#hintInfo").hide();
	}
}

function enableFields() {
	if (null != fromCAFlag && "true" == fromCAFlag) {
		liger.get("monIncmYuan").setEnabled();
		liger.get("highDgCd").setEnabled();
		$("#saveInsCfgDivInfo").show();
		$("#hintInfo").show();
		$("#hint").hide();
	}
	if (null != fromCMFlag && "true" == fromCMFlag) {
		liger.get("monIncmYuan").setEnabled();
		liger.get("highDgCd").setEnabled();
		$("#saveInsCfgDivInfo").show();
		$("#hintInfo").show();
		$("#hint").hide();
	}
}

// REQ-7008 只保存月收入
function saveInfo() {
	if ($("#saveInsCfgInfo").attr("class").indexOf("disabled") > 0) {
		return;
	}

	if(!$("#highDgCd").val()){
		top.$.ligerDialog.SQalert({content: "请选择学历！", SQ_type: "error"});
		return false;
	}
	if(!$("#monIncmYuan").val()){
		top.$.ligerDialog.SQalert({content: "请填写月收入！", SQ_type: "error"});
		return false;
	}
	var data = {};
	data["monIncmYuan"] = $("#monIncmYuan").val();
	data["highDgCd"] = $("#highDgCd").val();
	data["prjId"] = $("#prjId").val();
	data["cstId"] = $("#cstId").val();
	data["cstNm"] = $("#cstNm").val();
	data["fundRasInsId"] = $("#fundRasInsId").val();

	var url = '<%=path%>/institution/spdbank/saveInfo.do';
	var wait_dialog;
	$.ajax({
		type: 'post',
		dataType: 'json',
		data: data,
		url: url,
		beforeSend: function () {
			wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
		},
		success: function (msg) {
			wait_dialog.close();
			if (msg.success == 1) {
				UIUtils.alertSuccessHold1(msg.info);
			} else {
				UIUtils.alertErrorHold1(msg.info);
			}
		}
	});
}

</script>

</body>
</html>